﻿<UserControl x:Class="RB.Developer.Tools.UserControlConnStr"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignHeight="569" d:DesignWidth="606">
    <UserControl.Resources>
        <XmlDataProvider x:Key="databaseTypes" Source="/ConnectionStringDefine.xml" XPath="/DatabaseTypes/DatabaseType" />
        <DataTemplate x:Key="displayName">
            <TextBlock Text="{Binding XPath=DisplayName}" />
        </DataTemplate>
        <DataTemplate x:Key="tableName">
            <TextBlock Text="{Binding Path=TABLE_NAME}" />
        </DataTemplate>
    </UserControl.Resources>
    <Grid Width="602" Height="564">
        <Grid.RowDefinitions>
            <RowDefinition Height="54*" />
            <RowDefinition Height="44*" />
            <RowDefinition Height="47*" />
            <RowDefinition Height="44*" />
            <RowDefinition Height="40*" />
            <RowDefinition Height="95*" />
            <RowDefinition Height="105*" />
            <RowDefinition Height="136*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="117*" />
            <ColumnDefinition Width="150*" />
            <ColumnDefinition Width="76" />
            <ColumnDefinition Width="227" />
        </Grid.ColumnDefinitions>
        <Label Content="数据库类型" Height="28" HorizontalAlignment="Left" Margin="12,10,0,0" Name="label1" VerticalAlignment="Top" Grid.RowSpan="2" />
        <ComboBox Height="23" HorizontalAlignment="Left" Margin="15,12,0,0" Name="cmbDatabaseType" VerticalAlignment="Top" Width="120" Grid.Column="1" SelectionChanged="cmbDatabaseType_SelectionChanged" ItemsSource="{Binding Source={StaticResource databaseTypes}}" DisplayMemberPath="" ItemTemplate="{StaticResource displayName}">
            
        </ComboBox>
        <Label Content="服务器" Grid.Row="2" Height="28" HorizontalAlignment="Left" Margin="12,0,0,0" Name="label2" VerticalAlignment="Top" />
        <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="15,2,0,0" Name="txtServer" VerticalAlignment="Top" Width="120" />
        <Label Content="实例名称" Grid.Column="2" Grid.Row="2" Height="28" HorizontalAlignment="Left" Name="label3" VerticalAlignment="Top" />
        <TextBox Grid.Column="3" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="10,2,0,0" Name="txtInstance" VerticalAlignment="Top" Width="120" />
        <Label Content="Provider" Height="28" HorizontalAlignment="Left" Margin="12,0,0,0" Name="label4" VerticalAlignment="Top" Grid.Row="1" />
        <ComboBox Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="15,2,0,0" Name="cmbProvider" VerticalAlignment="Top" Width="120" Grid.Row="1" ItemsSource="{Binding ElementName=cmbDatabaseType, Path=SelectedItem/Providers/Provider}" ItemTemplate="{StaticResource displayName}" SelectionChanged="cmbProvider_SelectionChanged">

        </ComboBox>
        <Label Content="格式" Grid.Column="2" Grid.Row="1" Height="28" HorizontalAlignment="Left" Margin="0,1,0,0" Name="label5" VerticalAlignment="Top" />
        <ComboBox Grid.Column="3" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="10,2,0,0" Name="cmbFormat" VerticalAlignment="Top" Width="120" ItemTemplate="{StaticResource displayName}" SelectionChanged="cmbFormat_SelectionChanged" />
        <Label Content="用户名" Grid.Row="3" Height="28" HorizontalAlignment="Left" Margin="12,0,0,0" Name="label6" VerticalAlignment="Top" />
        <TextBox Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="15,2,0,0" Name="txtUserId" VerticalAlignment="Top" Width="120" />
        <Label Content="密码" Grid.Column="2" Grid.Row="3" Height="28" HorizontalAlignment="Left" Name="label7" VerticalAlignment="Top" />
        <TextBox Grid.Column="3" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="10,0,0,0" Name="txtPwd" VerticalAlignment="Top" Width="120" />
        <Label Content="文件路径/数据库名" Grid.Row="4" Height="28" HorizontalAlignment="Left" Margin="12,0,0,0" Name="label8" VerticalAlignment="Top" />
        <TextBox Grid.Column="1" Grid.Row="4" Height="23" HorizontalAlignment="Left" Margin="15,2,0,0" Name="txtPath" VerticalAlignment="Top" Width="341" Grid.ColumnSpan="3" />
        <Button Content="..." Grid.Column="3" Grid.Row="4" Height="23" HorizontalAlignment="Left" Margin="136,1,0,0" Name="btnSelectPath" VerticalAlignment="Top" Width="20" Click="btnSelectPath_Click" />
        <Label Content="模板" Height="28" HorizontalAlignment="Left" Margin="12,7,0,0" Name="label9" VerticalAlignment="Top" Grid.Row="5" />
        <TextBox Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="5" Height="43" HorizontalAlignment="Left" Margin="15,9,0,0" Name="txtTemplate" VerticalAlignment="Top" Width="386" IsReadOnly="True" TextWrapping="Wrap" />
        <Button Content="生成" Grid.Column="3" Grid.Row="5" Height="23" HorizontalAlignment="Left" Margin="81,58,0,0" Name="btnGenerate" VerticalAlignment="Top" Width="75" Click="btnGenerate_Click" />
        <Label Content="连接字符串" Grid.Row="6" Height="28" HorizontalAlignment="Left" Margin="12,8,0,0" Name="label10" VerticalAlignment="Top" />
        <TextBox Grid.ColumnSpan="3" Height="61" HorizontalAlignment="Left" IsReadOnly="True" Margin="15,-1,0,0" Name="txtConnectionString" TextWrapping="Wrap" VerticalAlignment="Top" Width="386" Grid.Column="1" Grid.Row="6" />
        <Button Content="测试连接" Grid.Column="3" Grid.Row="6" Height="23" HorizontalAlignment="Left" Margin="82,66,0,0" Name="btnTestConnect" VerticalAlignment="Top" Width="75" Click="btnTestConnect_Click" />
        <Label Content="数据表" Grid.Row="7" Height="28" HorizontalAlignment="Left" Margin="12,0,0,0" Name="label11" VerticalAlignment="Top" />
        <ListBox Grid.Column="1" Grid.Row="7" Height="124" HorizontalAlignment="Left" Margin="15,0,0,0" Name="lstTableName" VerticalAlignment="Top" Width="142" SelectionChanged="lstTableName_SelectionChanged" />
        <DataGrid AutoGenerateColumns="True" Grid.Column="3" Grid.Row="7" Height="124" HorizontalAlignment="Left" Margin="10,0,0,0" Name="dbgrdFields" VerticalAlignment="Top" Width="195" />
    </Grid>

</UserControl>
